﻿<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户登录</title>
</head>

<%
	Session.CodePage=65001
	Response.Charset="UTF-8"
%> 
<%
	Uname = Trim(request.Form("UserName"))
	PWD = Trim(request.Form("Passwd"))
	
	response.Write(Uname)
	response.Write(PWD)

	set dbConnection = Server.CreateObject("ADODB.Connection")
	dbConnection.Provider = "Microsoft.Jet.OLEDB.4.0"
	dbConnection.Open("D:\\工作资料\\web系统\\data\\activity.mdb")
	SQLStr = "select UserName, Passwd from Users where UserName='"&Uname&"' and Passwd='"&PWD&"';"
	
	set rs=Server.CreateObject("ADODB.recordset")
	'rs.Open "Select * from Users", dbConnection
	rs.Open SQLStr, dbConnection
	
	if rs.eof or rs.bof then '如果为空，即不存在
		Response.write("用户名密码错误")
	else '不为空则
		Session("Username")=Uname '纪录用户登录信息
		Session.Timeout = 30
		Response.write"登录成功"
		do until rs.EOF
  			for each x in rs.Fields
    			Response.Write(x.name)
    			Response.Write(" = ")
    			Response.Write(x.value & "<br />") 	
  			next
  			Response.Write("<br />")
  			rs.MoveNext
		loop
	if StrComp(Uname,"root") then
		Response.Redirect("home.asp")
	else
		response.Redirect("admin.asp")
	end if
	end if
	
	
	rs.close
	dbConnection.close
%>
<body>
</body>
</html>
